package org.mg.core.dao;

import org.mg.core.entity.Page;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

/**
 * @author MG
 * @since 06-04-2013
 */
public interface PageDao extends CrudRepository<Page, Long> {

    @Query("SELECT p FROM Page p LEFT JOIN FETCH p.pageDetails LEFT JOIN FETCH p.attachments WHERE p.id = :pageId")
    public Page getPageDetails(@Param("pageId") long pageId);
}
